import request from '@/utils/request'

// 查询任务列表
export function listTask(query) {
  return request({
    url: '/business/task/list',
    method: 'get',
    params: query
  })
}

// 查询任务详细
export function getTask(id) {
  return request({
    url: '/business/task/' + id,
    method: 'get'
  })
}

// 新增任务
export function addTask(data) {
  return request({
    url: '/business/task',
    method: 'post',
    data: data
  })
}

// 修改任务
export function updateTask(data) {
  return request({
    url: '/business/task',
    method: 'put',
    data: data
  })
}

// 删除任务
export function delTask(id) {
  return request({
    url: '/business/task/' + id,
    method: 'delete'
  })
}

// 提交任务
export function submitTask(taskId) {
  return request({
    url: '/business/task/submit?taskId=' + taskId,
    method: 'post'
  })
}

// 审核任务
export function auditTask(data) {
  return request({
    url: '/business/task/audit',
    method: 'post',
    data: data
  })
}

// 完成任务
export function endTask(taskId) {
  return request({
    url: '/business/task/end?taskId=' + taskId,
    method: 'post'
  })
}

// 获取点位
export function getPointByTask(taskId) {
  return request({
    url: '/business/task/point/' + taskId,
    method: 'get',
  })
}

// 获取点位
export function getSurveyByPointId(pointId, query) {
  return request({
    url: '/business/task/survey/' + pointId,
    method: 'get',
    params: query
  })
}

export function exportTaskZip(data) {
  //以文件流的方式返回数据
  return request({
    url: '/business/task/export',
    method: 'post',
    responseType:'blob',
    data: data
  })
}


export function selectTaskUser(query) {
  return request({
    url: '/business/task/select',
    method: 'get',
    params: query
  })
}

export function syncTaskData(id) {
  return request({
    url: '/business/task/syncData/' + id,
    method: 'post'
  })
}
